﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:oxy="clr-namespace:OxyPlot.Wpf;assembly=OxyPlot.Wpf"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:DataInterpolator.View"
      xmlns:Utility="clr-namespace:Common.Utility;assembly=Common"
      x:Class="DataInterpolator.View.InterpolationView" mc:Ignorable="d"
      d:DesignHeight="577.863" d:DesignWidth="701.888" Background="White">
   <UserControl.Resources>
      <Utility:InverseBooleanConverter x:Key="InverseBooleanConverter" />
   </UserControl.Resources>
   <UserControl.DataContext>
      <Binding Path="Interpolation" Source="{StaticResource Locator}" />
   </UserControl.DataContext>
   <Grid x:Name="LayoutRoot" Margin="5">
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
         <RowDefinition />
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
         <ColumnDefinition />
         <ColumnDefinition />
      </Grid.ColumnDefinitions>
      <GroupBox Header="Left Well" Margin="5">
         <Grid>
            <ComboBox VerticalAlignment="Center" HorizontalContentAlignment="Center"
                  ItemsSource="{Binding WellTitleChoices}"
                  SelectedValue="{Binding LeftWellTitle}" Margin="3" />
         </Grid>
      </GroupBox>
      <GroupBox Header="Right Well" Grid.Column="1" Margin="5">
         <Grid>

            <ComboBox VerticalAlignment="Center" HorizontalContentAlignment="Center"
                  ItemsSource="{Binding WellTitleChoices}"
                  SelectedValue="{Binding RightWellTitle}" Margin="3" />
         </Grid>
      </GroupBox>
      <GroupBox Header="Options" Grid.Row="1" Grid.ColumnSpan="2" Margin="5">
         <Grid>
            <Grid.Resources>
               <Style TargetType="{x:Type TextBlock}">
                  <Setter Property="Margin" Value="3" />
                  <Setter Property="Padding" Value="3" />
                  <Setter Property="VerticalAlignment" Value="Center" />
                  <Setter Property="TextTrimming" Value="CharacterEllipsis" />
               </Style>
               <Style TargetType="{x:Type TextBox}">
                  <Setter Property="Margin" Value="6" />
                  <Setter Property="TextWrapping" Value="Wrap" />
                  <Setter Property="VerticalAlignment" Value="Center" />
               </Style>
            </Grid.Resources>

            <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
               <ColumnDefinition Width="Auto" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="Auto" />
               <ColumnDefinition Width="*" />
               <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBlock Text="X-Axis Start" Height="23"
                  LineStackingStrategy="BlockLineHeight" />
            <TextBox Height="23" Text="{Binding XAxisMin}" Grid.Row="0" Grid.Column="1"
                  IsEnabled="{Binding UseXAxisDefaults, Converter={StaticResource InverseBooleanConverter}}" />
            <TextBlock Text="X-Axis End" Grid.Row="0" Grid.Column="2" />
            <TextBox Height="23" Text="{Binding XAxisMax}" Grid.Column="3" Grid.Row="0"
                  IsEnabled="{Binding UseXAxisDefaults, Converter={StaticResource InverseBooleanConverter}}" />
            <TextBlock Text="Sampling Interval (ft)" Height="23" Grid.Row="1"
                  Grid.Column="0" />
            <TextBox Height="23" Text="{Binding SamplingDistance}" Grid.Column="1"
                  Grid.Row="1" Grid.ColumnSpan="4" />

            <TextBlock Text="Interpolation Steps" Height="23" Grid.Row="2" Grid.Column="0" />
            <Slider Grid.Column="1" Minimum="1" IsSnapToTickEnabled="True"
                  Value="{Binding InterpolationLevels}" SmallChange="1" Grid.Row="2"
                  Grid.ColumnSpan="4" Padding="3" Margin="3"
                  VerticalContentAlignment="Center" VerticalAlignment="Center" />

            <Button Content="Recalculate Interpolation"
                  Command="{Binding RecalculateCommand, Mode=OneWay}"
                  HorizontalAlignment="Center" VerticalAlignment="Center" Width="140"
                  Padding="3" Grid.Row="3" Margin="3" Grid.ColumnSpan="2" />
            <Button Content="Reset All" Command="{Binding ResetAllCommand, Mode=OneWay}"
                  HorizontalAlignment="Center" VerticalAlignment="Center" Width="140"
                  Grid.Column="2" Grid.Row="3" Padding="3" Grid.ColumnSpan="14" Margin="3" />
            <CheckBox Content="Use Default" Grid.Row="0" Grid.Column="4"
                  VerticalAlignment="Center" Margin="3" Padding="4,3,3,3"
                  VerticalContentAlignment="Center" HorizontalContentAlignment="Center"
                  IsChecked="{Binding UseXAxisDefaults}" />

         </Grid>
      </GroupBox>
      <oxy:PlotView x:Name="Plot" Model="{Binding PlotViewModel, Mode=OneWay}" Margin="0"
            VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch"
            Grid.Row="2" Grid.ColumnSpan="2" />
   </Grid>
</UserControl>
